Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/open-api

Package Overview
Dependencies
Maintainers
17
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/open-api

Netlify's open-api definition as a module

  • 2.35.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
83K
decreased by-42.94%
Maintainers
17
Weekly downloads
 
Created

What is @netlify/open-api?

@netlify/open-api is an npm package that provides a client for interacting with the Netlify Open API. It allows developers to programmatically manage Netlify resources such as sites, deploys, forms, and more.

What are @netlify/open-api's main functionalities?

Create a new site

This feature allows you to create a new site on Netlify. You need to provide an access token and the site details.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function createSite() {
  const site = await client.createSite({
    body: {
      name: 'my-new-site'
    }
  });
  console.log(site);
}

createSite();

List all sites

This feature allows you to list all the sites associated with your Netlify account.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function listSites() {
  const sites = await client.listSites();
  console.log(sites);
}

listSites();

Create a new deploy

This feature allows you to create a new deploy for a specific site. You need to provide the site ID and the directory path of the site.

const NetlifyAPI = require('@netlify/open-api');
const client = new NetlifyAPI('your-access-token');

async function createDeploy(siteId, dir) {
  const deploy = await client.createSiteDeploy({
    site_id: siteId,
    body: {
      dir: dir
    }
  });
  console.log(deploy);
}

createDeploy('your-site-id', 'path/to/your/site');

Other packages similar to @netlify/open-api

Keywords

FAQs

Package last updated on 05 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc